package com.fire.control.system.module.file.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.fire.control.system.dto.app.AppFileVo;
import com.fire.control.system.entity.File;

public interface FileMapper{
	
	/**
	 * @author: xiechengguang 
	 * @Title: getFilesByRelationId   
	 * @Description: TODO  
	 */
	public List<String> getFilesByRelationId(String id);
	
	/**
	 * @author: xiechengguang 
	 * @Title: saveRelation   
	 * @Description: 保存文件 与 处理、报警表的对应关系  
	 */
	@Update("UPDATE t_file f SET f.relation_id = #{rid} WHERE f.id = #{fid}")
	public void saveRelation(@Param("rid") String rid, @Param("fid") String fid);
	
	/**
	 * @author: xiechengguang 
	 * @Title: saveFileAndObject   
	 * @Description: 保存文件--业务的关联关系中间表记录 
	 * @param:        
	 * @return: int      
	 * @throws
	 */
	@Insert("INSERT INTO t_file_object (id, file_id, object_id) VALUES (UUID(), #{fileId}, #{objectId})")
	public int saveFileAndObject(@Param("fileId") String fileId, @Param("objectId") String objectId);
	
	/**
	 * 
	 * @Title: getappdownloadFile
	 * @Description: 文件下载
	 * @param id
	 * @return
	 * @return: List<AppFileVo>
	 *@author:tanyuting
	 */
	@Select("SELECT f.* from t_app_manager a  join t_file f  on f.id=a.android_file_id  where 1=1 AND a.`status`=1 and f.`status`=1 ORDER BY a.create_time DESC LIMIT 0,1")
	public File getappdownloadFile();
	
	
	
	
	
	
	
	
}
